<?php

namespace App\Http\Middleware;

use Carbon\Carbon;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;

class Authenticate extends Middleware
{
    protected function redirectTo($request): ?string
    {
        if (!$request->expectsJson()) {
            return response()->json([
                'success' => false,
                'code' => 1200,
                'message' => 'Unauthenticated',
                'timestamp' => Carbon::now()->timestamp
            ])->setStatusCode(401);
        }
    }
}
